package com.zdemo.hash3;

public class HashHandler {

	private HashCache hashCache = new HashCache();
	
	public Integer getHash(Integer num) {
		Integer hashNum = this.hashCache.get(num);
		if (hashNum == null) {
			hashNum = this.hash(num);
			this.hashCache = new HashCache(num, hashNum);
		}
		return this.hashCache.getLastHashNum();
	}

	private Integer hash(Integer num) {
		Integer hashNum = num * 2;
		return hashNum;
	}

}
